package pl.skubicha.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;

import pl.skubicha.repository.UserRepository;

@Controller
@RequestMapping
public class AccessController {

	@Autowired
	private UserRepository userRepository;

	@RequestMapping( "/login" )
	public String login() {
		return "access/login";
	}

	@RequestMapping( "/denied" )
	public String denied( final ModelMap model ) {
		model.addAttribute( "status", "app.access.denied" );
		return "access/denied";
	}

	@RequestMapping( "/login/failure" )
	public String loginFailure( final ModelMap model ) {
		model.addAttribute( "status", "login.failure" );
		return "access/login";
	}

	@RequestMapping( "/logout/success" )
	public String logoutSuccess( final ModelMap model ) {
		model.addAttribute( "status", "logout.success" );
		return "access/login";
	}	
}